package com.king.zxing.util;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.king.zxing.R;

public class ToastUtil {

    public static void show(Context context,String s){
        View view = View.inflate(context, R.layout.zxing_custom_toast_layout,null);
        ((TextView)view.findViewById(R.id.text)).setText(s);
        Toast toast=new Toast(context);   //上下文
        toast.setGravity(Gravity.BOTTOM,0,DensityUtil.dip2px(context,69));   //位置底部
        toast.setDuration(Toast.LENGTH_SHORT);  //设置短暂提示
        toast.setView(view);   //把定义好的View布局设置到Toast里面
        toast.show();
    }
}
